package com.larry.spark.rdd.instance

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

object Spark01_RDD_Instance_File_partition {

  def main(args: Array[String]): Unit = {
    //TODO  使用spark

    val conf = new SparkConf().setMaster("local[*]").setAppName("rdd")
    val sc = new SparkContext(conf)

    //从内存中创建分区
    // def defaultMinPartitions: Int = math.min(defaultParallelism, 2)
    val rdd:RDD[String] = sc.textFile("data/num.txt")

    rdd.saveAsTextFile("output1")

    sc.stop()
  }


}
